cmake_minimum_required(VERSION 3.10)

project(deepsort_onnx LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

SET(OPENCV_DIR "/home/administrator/opencv-4.8.1/install/lib/cmake/opencv4" CACHE PATH "Location of libraries") 
find_package(OpenCV REQUIRED PATHS ${OPENCV_DIR} NO_DEFAULT_PATH)

set(ONNXRuntime_INCLUDE_DIRS "/home/administrator/Downloads/onnxruntime-linux-aarch64-1.21.0/include")
set(ONNXRuntime_LIB_DIRS "/home/administrator/Downloads/onnxruntime-linux-aarch64-1.21.0/lib")
set(EIGEN3_INCLUDE_DIR "/home/administrator/eigen-3.4.0/include/eigen3")

set(YOLOV8_ONNX "/home/administrator/hh_vision_lib/model_layer/object_detect/yolov8_onnxruntime")

include_directories(${EIGEN3_INCLUDE_DIR} ${OpenCV_INCLUDE_DIRS} ${ONNXRuntime_INCLUDE_DIRS}
${YOLOV8_ONNX})

link_directories(${YOLOV8_ONNX}/build)

file(GLOB ONNXRuntime_LIBS "${ONNXRuntime_LIB_DIRS}/*.so")

AUX_SOURCE_DIRECTORY(DEEP_APPEARANCE_DESCRIPTOR ${PROJECT_SOURCE_DIR}/DeepAppearanceDescriptor)
AUX_SOURCE_DIRECTORY(KALMAN_FILTER ${SRC} ${PROJECT_SOURCE_DIR}/KalmanFilter)
AUX_SOURCE_DIRECTORY(MUNKRES_ASSIGNMENT ${PROJECT_SOURCE_DIR}/MunkresAssignment)


add_library(deepsort_onnx SHARED
    
    DeepAppearanceDescriptor/FeatureTensor.cpp
    DeepAppearanceDescriptor/model.cpp
    KalmanFilter/kalmanfilter.cpp
    KalmanFilter/linear_assignment.cpp
    KalmanFilter/nn_matching.cpp
    KalmanFilter/track.cpp
    KalmanFilter/tracker.cpp
    MunkresAssignment/munkres/munkres.cpp
    MunkresAssignment/hungarianoper.cpp
    DeepAppearanceDescriptor/dataType.h
    DeepAppearanceDescriptor/FeatureTensor.h
    DeepAppearanceDescriptor/model.h
    KalmanFilter/kalmanfilter.h
    KalmanFilter/linear_assignment.h
    KalmanFilter/nn_matching.h
    KalmanFilter/track.h
    KalmanFilter/tracker.h
    MunkresAssignment/munkres/matrix.h
    MunkresAssignment/munkres/munkres.h
    MunkresAssignment/hungarianoper.h
)

add_executable(deepsort_onnx_demo
    main.cpp
)
target_link_libraries(deepsort_onnx_demo
    PRIVATE        
        deepsort_onnx
        opencv_world
        yolov8_onnx_lib
        ${ONNXRuntime_LIBS}
)

target_link_libraries(deepsort_onnx
    PRIVATE        
        opencv_world
        ${ONNXRuntime_LIBS}
)
target_include_directories(deepsort_onnx
    PRIVATE        
        ${OpenCV_INCLUDE_DIRS}
        ${EIGEN3_INCLUDE_DIR}
)